<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.domain.ZhongLei,java.util.ArrayList,com.domain.*"%>

<%
YongHu yonghu=(YongHu)session.getAttribute("yonghu");

	
ArrayList<ShangPin> fenleishangpin=(ArrayList<ShangPin>)session.getAttribute("fenleishangpin");
ShangPin shangpin;

if(yonghu==null || !yonghu.getQuanxian().equals("guanliyuan"))
{
	request.getRequestDispatcher("guanliyuandenglu.jsp").forward(request, response);
}
if(fenleishangpin==null)
{
	request.getRequestDispatcher("guanlizhonglei.jsp").forward(request, response);
}

String tianjiashangpinjieguo=(String)session.getAttribute("tianjiashangpinjieguo");
session.removeAttribute("tianjiashangpinjieguo");

%>

<html>
	<head>
		<style>A{text-decoration: NONE} </style>
		<title>商品列表</title>
	</head>
	<body >
	<table width="90%" align="center"  bgcolor="#d0eed8" border="1">
		<%
	if(tianjiashangpinjieguo!=null)
	{
%>
		<tr height="200">
			<td align="center" colspan="2"><font size="7"><%=tianjiashangpinjieguo%></font></td>			
		</tr>
<%		
	}
%>
		<tr height="200">
			<td align="center"><font size="7"><a href="houtaishouye.jsp">返回首页</a></font></td>			
		</tr>
		<tr height="200">
			<td align="center"><font size="7"><a href="guanlizhonglei.jsp">返回分类列表</a></font></td>			
		</tr>
	</table>

	

	<table align="center" width="90%" bgcolor="#d0eed8" border="1" cellspacing="10" >	
	
	
		
		<form action="Tianjiashangpin" method="post" enctype="multipart/form-data">
			<tr height="100">
				<td width="50%"><font size="5" >商品名称：<input name="shangpinmingcheng"  type="text"  size="50"/></font></td>
				<td ><font size="5">商品价格：<input name="shangpinjiage"  type="text"  size="30"/></font></td>
				
				<td align="center" rowspan="3" width="20%"><input name="submit1" value="添加商品" type="submit" style="width:150;height:60;"/></td>			
			</tr>
			<tr height="100" >
				<td><font size="5">商品描述：<input name="shangpinmiaoshu"  type="text" size="50"/></font></td>
				<td><font size="5">商品数量：<input name="shangpinshuliang"  type="text" size="30"/></font></td>
			</tr> 
			<tr height="100">
				<td  colspan="2"><font size="5">选择图片：<input name="tupian" type="file"size="100"/></font></td>
			</tr>
		</form>			
	</table>



	<table align="center" width="90%" bgcolor="#d0eed8" border="1" cellspacing="10" >	
		<colgroup width="15%" span="6">
		<tr align="center" height="100">
			
			<td><font size="6">图片</font></td>
			<td><font size="6">名字</font></td>
			<td><font size="6">描述</font></td>
			<td><font size="6">价格</font></td>
			<td><font size="6">数量</font></td>
			<td><font size="6">操作</font></td>
			
		</tr>	
<%
		for(int i=fenleishangpin.size()-1;i>=0;i--)
		{
			shangpin=fenleishangpin.get(i);			
%>		
		
			<tr align="center">

				<td rowspan="2"><img src="./images/<%=shangpin.getTupian().get(0) %>.jpg" width="100%"></td>
				<td rowspan="2"><%=shangpin.getMingzi() %></td>
				<td rowspan="2"><%=shangpin.getMiaoshu() %></td>
				<td rowspan="2"><%=shangpin.getJiage() %></td>
				<td rowspan="2"><%=shangpin.getShuliang() %></td>
				<td><a href="Bianjishangpin?shangpinbianhao=<%=shangpin.getBianhao() %>">编辑</a></td>
			</tr>
			<tr align="center">
				<td><a href="Shanchushangpin?shangpinbianhao=<%=shangpin.getBianhao() %>">删除</a></td>
			</tr>
<%								
		}
%>	
	</table>	 			
  </body>
</html>
